﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using YArchitech.LIB;

namespace YArchitech.HVAC
{
	public partial class SetDataFilePathForm : System.Windows.Forms.Form
	{
		public string FilePath { get; set; }

		public SetDataFilePathForm()
		{
			this.InitializeComponent();
		}

		public SetDataFilePathForm(string filePath) : this()
		{
			base.Icon = Resource.YArchitechIcon;
			this.textBox1.Text = filePath;
		}

		private void btnScan_Click(object sender, EventArgs e)
		{
			if (Directory.Exists(this.textBox1.Text))
			{
				this.folderBrowserDialog1.SelectedPath = this.textBox1.Text;
			}
			if (DialogResult.OK == this.folderBrowserDialog1.ShowDialog())
			{
				this.textBox1.Text = this.folderBrowserDialog1.SelectedPath;
			}
		}

		private void SetDataFilePathForm_FormClosing(object sender, FormClosingEventArgs e)
		{
			this.FilePath = this.textBox1.Text;
		}
	}
}
